﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Chat.Common;
public class GameRoot : MonoBehaviour
{
    private bool isClosed =false;
    private void Awake()
    {
        Singleton<ContentManager>.GetInstance().Push(new GeneralPanelContent());
        Singleton<ChatClient>.GetInstance().OnConnectionClosed += () => {
            isClosed = true;
        };
    }

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if(isClosed)
        {
            Singleton<ContentManager>.GetInstance().Push(new ConnectionClosedPanelContent());
            isClosed = false;
        }
    }
    private void OnApplicationQuit()
    {
        Singleton<ChatClient>.GetInstance().Destory();
    }

    
}
